package cn.ydxiaoshaui.aip.imageclassify.bean;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

import java.io.Serializable;
import java.util.List;

/**
 * @Description 果蔬类食材识别
 * @author 小帅丶
 * @className IngredientDetect
 * @Date 2019/9/26
 **/
public class IngredientDetect implements Serializable {
    private static final long serialVersionUID = 1L;

    /** 唯一的log id，用于问题定位 */
    private Long log_id;
    /** 返回结果数目，及result数组中的元素个数 */
    private Integer result_num;
    /** 标签结果数组 */
    private List<Result> result;

    public Long getLog_id() {
        return log_id;
    }

    public void setLog_id(Long log_id) {
        this.log_id = log_id;
    }

    public Integer getResult_num() {
        return result_num;
    }

    public void setResult_num(Integer result_num) {
        this.result_num = result_num;
    }

    public List<Result> getResult() {
        return result;
    }

    public void setResult(List<Result> result) {
        this.result = result;
    }

    private static class Result{
        /** 置信度，0-1 */
        private Double score;
        /** 图像中的食材名称 */
        private String name;

        public Double getScore() {
            return score;
        }

        public void setScore(Double score) {
            this.score = score;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this, new SerializerFeature[] {
                SerializerFeature.WriteMapNullValue,
                SerializerFeature.WriteNullListAsEmpty,
                SerializerFeature.WriteNullStringAsEmpty,
                SerializerFeature.WriteNullNumberAsZero,
                SerializerFeature.WriteNullBooleanAsFalse,
                SerializerFeature.UseISO8601DateFormat });
    }
}
